p_CLASSCODE = «SPBFUT» --Код класса
p_SECCODE = «SiU0» --Код инструмента
function OnInit()
frame_60min = CreateDataSource (p_CLASSCODE, p_SECCODE, INTERVAL_H1)
frame_5min = CreateDataSource (p_CLASSCODE, p_SECCODE, INTERVAL_M5)
Index_60min = nil
Index_5min = nil
LastPrice = nil
IsRun = true
end
function main()
CreateTable()
while IsRun do
if Index_60min ~= frame_60min:Size() then
Index_60min = frame_60min:Size()
end
if Index_5min ~= frame_5min:Size() then
Index_5min = frame_5min:Size()
Transaq = 0
BuyWay = 0
SellWay = 0
end
if LastPrice ~= frame_60min:C(Index_60min) then
LastPrice = frame_60min:C(Index_60min)
BuySignal(frame_60min, Index_60min)
SellSignal(frame_60min, Index_60min)
if BuySpeed ~= nil and SellSpeed ~= nil then
if LastPrice < BuyPrice and BuySpeed > SellSpeed then
SetCell(t_id, 1, 4, «Buy»)
elseif LastPrice > SellPrice and SellSpeed > BuySpeed then
SetCell(t_id, 1, 4, «Sell»)
else
SetCell(t_id, 1, 4, «None»)
end
end
end
sleep(10)
end